#include("/template/common/layout/_page_layout.html")
#@layout()

#define css()
<style>
    button {
        background: #758ef0;
        color: #FFF;
        border: none;
        border-radius: 15px;
    }
</style>
#end

#define content()   <!--隐藏id-->

<div class="x-body">
    <input type="text" id="id" name="id"
           class="layui-input layui-disabled layui-hide" value="#(id)" required/>

    <div class="layui-row">
        <table id="dateTable" lay-filter="dateTable"></table>
    </div>

    <script type="text/html" id="barOption">
        <a class="layui-btn layui-btn-xs" lay-event="invite">审查详情</a>
    </script>
</div>
#end

#define js()
<script type="text/javascript">

    layui.use(['table', 'layer'], function () {
        var table = layui.table, layer = layui.layer;


        // 审核通过的表格渲染
        var tableIns = table.render({
            elem: '#dateTable'                  //指定原始表格元素选择器（推荐id选择器）
            , id: 'dateTable'
            , even: true //开启隔行背景
            , size: 'sm' //小尺寸的表格
            , height: 'full-150'    //容器高度
            , contentType: 'application/json; charset=UTF-8'
            , cols: [[                  //标题栏
                {type: 'numbers', fixed: true, unresize: 'true'}
                , {field: 'name', title: '姓名', width: 100, sort: true}
                , {field: 'sex', title: '性别', width: 100, sort: true}
                , {field: 'address', title: '地址', width: 200, sort: true}
                , {field: 'phone', title: '联系电话', width: 110, templet: function(d){return d.user? (d.user.phone||'') : '';}}
                , {field: 'remark', title: '审查状态', width: 120,
                    templet: '#statusTpl(io.jboot.admin.service.entity.status.system.ApplyInviteStatus::me(), "remark")'}
                , {fixed: 'right', title: '操作', minWidth:100, align: 'center', toolbar: '#barOption'} //这里的toolbar值是模板元素的选择器
            ]]
            , url: '#(ctxPath)/app/project/invitedExpertTable?id=' + $('#id').val()
            , method: 'get'
            , request: {
                pageName: 'pageNumber' //页码的参数名称，默认：page
                , limitName: 'pageSize' //每页数据量的参数名，默认：limit
            }
            , initSort: {
                field: 'createTime'//按照时间进行默认排序
                ,type: 'desc'
            }
            , page: true
            , limits: [30, 60, 90, 150, 300]
            , limit: 30 //默认采用30
            , loading: true
            , done: function (res, curr, count) {
            }
        });

        table.on('tool(dateTable)', function (obj) {
            var data = obj.data;
            if (obj.event === 'invite') {
                window.location.href = '#(ctxPath)/app/ass_review/findPageAndShow?projectId=' + $('#id').val() + '&roleType=4'
                /*$.ajax({
                    type: 'POST',
                    //url: '#(ctxPath)/app/project/invitedExpert?id=' + data.id + '&projectId=' + $('#id').val(),
                    success: function () {
                        window.location.reload();
                    }
                 });*/
            }
        });
    });

</script>
#end